package com.tianlh.service.enums;

import lombok.Getter;

/**
 * @author 黑子
 * @Date 2018/2/2 15:53
 */
public enum OrderStatusEnum {
    INIT_ORDER(1, "下单未付款"),

    PAY_SUCCESS(2, "已付款"),

    BOOK_SUCCESS(3, "出票成功"),

    CLOSED_ORDER(4, "订单关闭"),

    CANCEL_ORDER(5, "订单取消"),

    REFUND_ORDER(9, "退款订单"),

    REFUND_SUCCESS(11, "退款成功");

    public final static OrderStatusEnum of(String value) {
        value = value != null ? value.trim() : null;
        int status = Integer.parseInt(value);
        return of(status);
    }

    public final static OrderStatusEnum of(int value) {
        for (OrderStatusEnum status : OrderStatusEnum.values()) {
            if (value == status.value) {
                return status;
            }
        }
        return null;
    }

    @Getter
    private int value;
    private String description;

    OrderStatusEnum(int value, String description) {
        this.value = value;
        this.description = description;
    }
}
